home *** CD-ROM | disk | FTP | other *** search
/ CD/PC Actual Thematic 7: Programming / CDAT7.iso / demos / VisualAge for Java 2.0 Entry / setup / data1.cab / ide-e / IDE / cache / 1XPTJZB (.txt) < prev    next >
Encoding:
Java Class File  |  1998-09-16  |  1.8 KB  |  54 lines

  1. package com.sun.java.swing.text;
  2.  
  3. import com.sun.java.swing.event.DocumentEvent;
  4. import com.sun.java.swing.undo.AbstractUndoableEdit;
  5. import com.sun.java.swing.undo.CannotRedoException;
  6. import com.sun.java.swing.undo.CannotUndoException;
  7.  
  8. public class AbstractDocument$ElementEdit extends AbstractUndoableEdit implements DocumentEvent.ElementChange {
  9.    // $FF: renamed from: e com.sun.java.swing.text.Element
  10.    private Element field_0;
  11.    private int index;
  12.    private Element[] removed;
  13.    private Element[] added;
  14.  
  15.    public AbstractDocument$ElementEdit(Element e, int index, Element[] removed, Element[] added) {
  16.       this.field_0 = e;
  17.       this.index = index;
  18.       this.removed = removed;
  19.       this.added = added;
  20.    }
  21.  
  22.    public Element getElement() {
  23.       return this.field_0;
  24.    }
  25.  
  26.    public int getIndex() {
  27.       return this.index;
  28.    }
  29.  
  30.    public Element[] getChildrenRemoved() {
  31.       return this.removed;
  32.    }
  33.  
  34.    public Element[] getChildrenAdded() {
  35.       return this.added;
  36.    }
  37.  
  38.    public void redo() throws CannotRedoException {
  39.       super.redo();
  40.       Element[] tmp = this.removed;
  41.       this.removed = this.added;
  42.       this.added = tmp;
  43.       ((AbstractDocument.BranchElement)this.field_0).replace(this.index, this.removed.length, this.added);
  44.    }
  45.  
  46.    public void undo() throws CannotUndoException {
  47.       super.undo();
  48.       ((AbstractDocument.BranchElement)this.field_0).replace(this.index, this.added.length, this.removed);
  49.       Element[] tmp = this.removed;
  50.       this.removed = this.added;
  51.       this.added = tmp;
  52.    }
  53. }
  54.